package com.ss.android.newmedia.message.a;

import android.content.Context;
import android.hardware.display.DisplayManager;
import android.os.Build;
import android.os.PowerManager;
import android.view.Display;

import com.ss.android.common.app.AbsApplication;

public class e {
    private static volatile e b;
    public Context a;

    private e(Context arg2) {

        this.a = arg2.getApplicationContext();
    }

    public static e a(Context arg2) {
        if (e.b == null) {
            Class v1 = e.class;
            synchronized (v1) {
                if (e.b == null) {
                    e.b = new e(arg2);
                }
            }
        }

        return e.b;
    }

    public static boolean b() {
        boolean v0 = true;
        if (AbsApplication.getApplication().getSharedPreferences("app_setting", 0).getInt("tt_lockscreen_notification_enabled", 0) != 1) {
            v0 = false;
        }

        return v0;
    }

    public final boolean a() {
        try {
            if (Build.VERSION.SDK_INT >= 20) {
                Display[] v0_1 = ((DisplayManager) this.a.getSystemService("display")).getDisplays();
                if (v0_1 == null) {
                    return false;
                }

                if (v0_1.length <= 0) {
                    return false;
                }

                int v0_2 = v0_1[0].getState();
                if (1 != v0_2 && 3 != v0_2 && 4 != v0_2) {
                    return false;
                }

                boolean v0_3 = true;
                return v0_3;
            }

            if (((PowerManager) this.a.getSystemService("power")).isScreenOn()) {
                return false;
            }
        } catch (Throwable v0) {
            v0.printStackTrace();
            return false;
        }

        return true;

    }
}

